/**
 * Copyright (C) 2008  Paul Boonyarungsrit
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.tboonyar.maven.plugin.portletcontainer;

import org.apache.tools.ant.Project;

/**
 * Deploy the portlet war to portlet container.
 * 
 * @goal deploy
 * @description Deploy the portlet war
 */
public class DeployMojo
    extends AbstractPortletContainerMojo
{

    /**
     * Portlet war file.
     * 
     * @parameter expression = "${project.build.directory}/${project.build.finalName}.war"
     * @required
     */
    protected String portletWar;

    /**
     * Roles file.
     * 
     * @parameter expression = "${rolesFile}"
     */
    protected String rolesFile;

    void configureProperties( final Project project )
    {
        getLog().debug( "Deploying portlet: " + portletWar );
        getLog().debug( "Roles File: " + rolesFile );

        project.setProperty( "portlet-war", portletWar );

        if ( rolesFile != null )
        {
            project.setProperty( "roles-file", rolesFile );
        }
    }

    String getTarget()
    {

        return "deploy-portlet";
    }
}
